

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link media="all" href="../css/base.css" type="text/css" rel="stylesheet">
<link media="all" href="../css/index.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/heloo.slide.js"></script>
<title>超级派单员-何乐而不为</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta content="" name="Keywords">
<meta content="" name="Description">
<!-- Mobile Devices Support @begin -->
<meta http-equiv="Content-Type" content="application/xhtml+xml;charset=UTF-8">
<meta http-equiv="Cache-Control" content="no-cache,must-revalidate">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="0">
<meta name="format-detection" content="telephone=no, address=no">
<meta content="yes" name="apple-mobile-web-app-capable"> <!-- apple devices fullscreen -->
<meta content="black-translucent" name="apple-mobile-web-app-status-bar-style">
<!-- Mobile Devices Support @end -->
<link href="favourite.ico" rel="shortcut icon">
</head>
<body id='body_new_index'>
<section class="top newIndex">
      <div class="address">
      	  <a href='choose_city.html' target='_blank'><span id="cityName" >杭州</span></a>
      </div>
	  <a class='search_icon'  href='list_discount_search.html' target='_blank'></a>	
	</section>
	<header class='index'>
	<table class='index_table' style='position:relative;z-index:999'>
		<tr>
			<td></td>
			<td>
			  <a class='index_b'>
			     <span class='typelist_nav_name'>全部类别</span>
		      </a>
			 
			</td>
			<td></td>

			<td>
			  <a class='index_b'>
			    <span class='area_nav_name'>全部地区</span>
		      </a>
			</td>
			<td></td>			
		</tr>
		<tr>
			<td></td>
			<td>
  			  <div class='subnav'>
  			  	<img src='../images/up.png'>
				<div class='subnav_content typelist_nav'>
					<a>全部类别</a>
					<a>餐饮</a>
					<a>娱乐</a>
					<a>生活服务</a>
					<a>酒店</a>
					<a>旅游</a>
					<a>教育</a>
			    </div>
  			  </div>			  
			 
			</td>
			<td></td>
			<td>
  			  <div class='subnav'>
  			  	<img src='../images/up.png'>
				<div class='subnav_content area_nav'>
				<a>上城区</a>
				<a>滨江区</a>
				<a>拱墅区</a>
				<a>下城区</a>
			    </div>
  			  </div>
			</td>
			<td></td>			
		</tr>
	</table>
    </header>

	<div class="slide">
        <div class="box_swipe" id="banner_box">
            <ul>
             <li>
			  <a href="">
				 <img src="../images/new_banner01.jpg" alt="" />
			  </a> 
			 </li>
             <li>
			  <a href="">
				 <img src="../images/new_banner02.jpg" alt="" />
			  </a> 
			 </li>			
        	</ul>
            <ol>
                <li class="on"></li>
                <li></li>
            </ol>
        </div> 
    </div>
    
	

	<div id="index_content">
		
	
	  <!-- 渲染完毕的html结构
	  <article>
	     <div class='c'>
		  <img class='img_head' dearDeveloper='图像大小148px*106px' src='../images/json.png' />
		  <h3 class='setover v'>店铺名称店铺名称店铺名称店铺名称</h3>
		  <h4><div class='line'><i>上城</i><i>餐饮美食</i> <i class='right'>3款优惠</i><div></h4>
		  <div class='zan'><i class='icon_index'></i>990</div>
		 </div>
		 <aside class='setover'><span class="span_tip span_orange">买送活动</span>指定饮品买一送一</aside>
		 <aside class='setover'><span class="span_tip span_green">超值套餐</span>下午茶超值套餐18元 下午茶超值套餐18元下午茶超值套餐18元下午茶超值套餐18元下午茶超值套餐18元下午茶超值套餐18元</aside>
	     <a href="" class="more_discount icon_index"></a>
	  </article>
	
	  <article>
	     <div class='c'>
		  <img class='img_head' src='../images/json.png' /> 
		  <h3 class='setover v'>店铺名称店铺名称店铺名称店铺名称</h3>
		  <h4><div class='line'><i>上城</i><i>餐饮美食</i> <i class='right'>3款优惠</i><div></h4>
		  <div class='zan'><i class='icon_index'></i>990</div>
		 </div>
		 <aside class='setover'><span class="span_tip span_blue">超低折扣</span>全场0.01折</aside>
		 <aside class='setover'><span class="span_tip span_green">超值套餐</span>下午茶超值套餐18元 下午茶超值套餐18元下午茶超值套餐18元下午茶超值套餐18元下午茶超值套餐18元下午茶超值套餐18元</aside>
	     <a href="" class="more_discount icon_index"></a>
	  </article>

	  <article>
	     <div class='c'>
		  <img class='img_head' src='../images/json.png' />
		  <h3 class='setover v'>店铺名称店铺名称店铺名称店铺名称</h3>
		  <h4><div class='line'><i>上城</i><i>餐饮美食</i> <i class='right'>3款优惠</i><div></h4>
		  <div class='zan'><i class='icon_index'></i>990000</div>
		 </div>
		 <aside class='setover'><span class="span_tip span_orange">买送活动</span>指定饮品买一送一</aside>
		 <aside class='setover'><span class="span_tip span_green">超值套餐</span>下午茶超值套餐18元 下午茶超值套餐18元下午茶超值套餐18元下午茶超值套餐18元下午茶超值套餐18元下午茶超值套餐18元</aside>
	     <a href="" class="more_discount icon_index"></a>
	  </article>	  
	  -->
	</div>
	
	
	
	<table class='index_table' id='detail_table'>
			
		
	</table>
    <input type="hidden" class='currentPage' currentPage='0' />
	
	<nav class='index_footer'>
	 <a class='active'><i class='icon_index'></i><span>优惠商城</span></a>
	 <a><i class='icon_index'></i><span>我的优惠券</span></a>
	 <a><i class='icon_index'></i><span>我要提现</span></a>
	 <a><i class='icon_index'></i><span>用户中心</span></a>
	</nav>
	
<script type="text/javascript">
   $(function(){
   
       //阻止事件冒泡
	   function stopEventUp(e){
	   	var evt = e ? e : window.event; 
		if (evt.stopPropagation) { 
		//W3C 
		evt.stopPropagation(); 
		} 
		else { 
		//IE 
		evt.cancelBubble = true; 
	    }
	   
	   }
   
       //事件代理 块状内容点击事件
       $('#index_content').delegate('article','click',function(){
	      location.href = $(this).attr('url');
	   })
       
	   //事件代理，点赞阻止事件冒泡，防止页面跳转
       $('#index_content').delegate('.zan','click',function(e){
	      stopEventUp(e);
		  if(!$(this).hasClass('bounceIn')){
			  $(this).addClass('bounceIn');
			  var span = $(this).find('span');
			  var num = span.html();
			  span.html(parseInt(num)+1);	

              //{....}执行一些数据传输工作	  
			  
		  }
		  else{
		    alert('亲，您已经赞过了哦！')
		  }
	   })	   
   
       //顶部通栏滑动切换
		new Swipe(document.getElementById('banner_box'), {
			speed:500,
			auto:false,
			callback: function(){
			 var lis = $(this.element).next("ol").children();
			 lis.removeClass("on").eq(this.index).addClass("on");
			}
		});


	   //二级菜单弹出
	   $('a.index_b').parent().width($('a.index_b').width());
	   $('a.index_b').click(function(e){
           stopEventUp(e)
	   	   var index = $(this).parent().index();
		   if(index==1){
			   if($('.subnav').eq(0).css('display') != 'none'){
			   	  $('.subnav').eq(0).fadeOut(200)
			   }
			   else{
			   $('.subnav').fadeOut(200)
               $('.subnav').eq(0).fadeIn(500)			   	
			   }	   
		   }
		   else{
			   if($('.subnav').eq(1).css('display') != 'none'){
			   	  $('.subnav').eq(1).fadeOut(200)
			   }
			   else{
			   $('.subnav').fadeOut(200)
		   	   $('.subnav').eq(1).fadeIn(500)				   	
			   }
		   }
	   })
	   $('body').click(function(){
	   	$('.subnav').fadeOut(200)
	   });
	   
	   
	   
	
  var heloo_ajax = function(){
	var data = {};
	data.currentPage = $('.currentPage').attr('currentPage') || '01';  //把当前页面传进去  
    $.ajax({ 
            type: "post", 
			url: "js/json_index.js", 
			dataType: "json", 
			data:data,
			success: function (data) { 
			    var html = '';
			    for(var i = 0 ; i < data[0].detail.length; i++){
				    html +=  '<article url="'
							  + data[0].detail[i].alUrl
							  + '"><div class="c"><img class="img_head" src="'
							  + data[0].detail[i].imgUrl
							  + '" /><h3 class="setover '
							  + data[0].detail[i].ident
							  + '">'
							  + data[0].detail[i].detailName
			                  + '</h3><h4><div class="line"><i>' 
							  + data[0].detail[i].detailPoint[0] 
							  + '</i><i>' 
							  + data[0].detail[i].detailPoint[1] 
							  + '</i><i class="right">' 
							  + data[0].detail[i].disNum 
							  + '款优惠</i><div></h4>'
                              + '<div class="zan"><i class="icon_index"></i><span>' 
							  + data[0].detail[i].zanNum 
							  + '</span></div></div>';
                    var temp = '';
                    for(var j = 0;j <= data[0].detail[i].disDetail.length;j++){
					    if(j==2){ //当优惠总数大于2的时候，我们只显示2条，然后增加一个末尾图标，并直接跳出循环
						  temp += '<a  class="more_discount icon_index"></a>';
						  break;
						}
					     temp += '<aside class="setover"><span class="span_tip_wrap"><span class="span_tip ' 
						       + data[0].detail[i].disDetail[j].class + '">' 
						       + data[0].detail[i].disDetail[j].tip 
							   + '</span></span>'
							   + data[0].detail[i].disDetail[j].text 
							   + '</aside>'						
 					}	
                    html += temp + '</article>';				
						
				}
			    $('#index_content').append($(html));
			}, 
			error: function (XMLHttpRequest, textStatus, errorThrown) { 
					alert(errorThrown); 
			} 
        });  
  }	

      heloo_ajax();
		//下拉加载更多，事件绑定
	   var resizeTimer_ajax = null;
	   $(window).scroll(function(){
		   if( ( $(document).scrollTop() +260 )>=$(document).height()-$(window).height() ){  //距离底部一定位移开始请求
			     $('.spinner').animate({height:30},10);
			     if (resizeTimer_ajax) {
						//console.log('你拉太快，再等等');
						clearTimeout(resizeTimer_ajax)
				 }
				 resizeTimer_ajax = setTimeout(function(){
						console.log('成功发送请求！');
						heloo_ajax(); 	 
				 }, 500);	
		         
			 }
		});

   
   
   
   
   
   
   
          $('.typelist_nav a').bind('click',function(){
		    if( $(this).attr('select')==true){   //添加selected属性，判断是否已被点击
			  return;
			}else{
			     $(this).parent().find('a').attr('select','false');
			     $(this).attr('select','true');
			     var html = $(this).html();
			     $('.typelist_nav_name').html(html);
			    
			}
		});
		
		$('.area_nav a').bind('click',function(){
		    if( $(this).attr('select')==true){   //添加selected属性，判断是否已被点击
			  return
			}
			else{
		     $(this).parent().find('a').attr('select','false')
		     $(this).attr('select','true');
		     var html = $(this).html();
		     $('.area_nav_name').html(html);
		     //alert(html);

		}});   
   
   
   
   });
</script>	
</body>
</html>